<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var arr = [1,2,3,[4,5,[6,7]]];
    function deepCopy(arr){
        var list = [];
        for(var i = 0;i<arr.length;i++){
            var item = arr[i]; // 取出数组中的每一个元素
            if(Array.isArray(item)){  //如果是数组  item = [4,5,[6,7]]
                var copyArr = deepCopy(item); // [4,5,[6,7]]
                list.push(copyArr);
            }else{  //值类型(没有考虑对象)
                list.push(item);
            }
        }
        return list;
    }
    console.log(deepCopy(arr));
</script>
</html>